fallback to floor function when rint function is not available.
authorJan Heller <jheller@svn.gnome.org>
Tue, 20 May 2008 22:11:12 +0000 (22:11 +0000)
committerJan Heller <jheller@src.gnome.org>
Tue, 20 May 2008 22:11:12 +0000 (22:11 +0000)
2008-05-21  Jan Heller  <jheller@svn.gnome.org>

        * babl/babl-internal.h:
        * babl/base/type-u16.c:
        * babl/base/type-u32.c:
        * babl/base/type-u8.c:
        * extensions/CIE-Lab.c:
        * extensions/gegl-fixups.c:
        * extensions/gggl-lies.c:
        * extensions/gggl.c:
        * extensions/gimp-8bit.c:
        * extensions/util.h: fallback to floor function when rint function
        is not available.

        * configure.ac: added check for rint function.

svn path=/trunk/; revision=313

12 files changed:
ChangeLog
babl/babl-internal.h
babl/base/type-u16.c
babl/base/type-u32.c
babl/base/type-u8.c
configure.ac
extensions/CIE-Lab.c
extensions/gegl-fixups.c
extensions/gggl-lies.c
extensions/gggl.c
extensions/gimp-8bit.c
extensions/util.h

index 215991c7d35d0bbf39cf485625f75e166d01f766..c6cf2ccc190a1f80ec802ad07b87e99a2a960f72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-05-21  Jan Heller  <jheller@svn.gnome.org>
+
+       * babl/babl-internal.h:
+       * babl/base/type-u16.c:
+       * babl/base/type-u32.c:
+       * babl/base/type-u8.c:
+       * extensions/CIE-Lab.c:
+       * extensions/gegl-fixups.c:
+       * extensions/gggl-lies.c:
+       * extensions/gggl.c:
+       * extensions/gimp-8bit.c:
+       * extensions/util.h: fallback to floor function when rint function
+       is not available.
+
+       * configure.ac: added check for rint function.
+
 2008-05-20  Jan Heller  <jheller@svn.gnome.org>
 
        * extensions/gimp-8bit.c (conv_rgbaF_linear_rgb8_linear),
index 6d20b2b3fc564017417d084a69f6a0d9d7fa10dd..c7d6110f020e0b9ec9661675c834e9948cfea4ac 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <math.h>
 #include "assert.h"
 
 #undef  _BABL_INTERNAL_H
 #include "babl.h"
 #define _BABL_INTERNAL_H
 
+#include "config.h"
+
 #include "babl-list.h"
 #include "babl-hash-table.h"
 #include "babl-db.h"
 #define random  rand
 #endif
 
+/* fallback to floor function when rint is not around */
+#ifndef HAVE_RINT
+# define rint(f)  ((long) floor (((double) f) + 0.5))
+#endif
+
+
+
 Babl * babl_conversion_find       (const void     *source,
                                          const void     *destination);
 double   babl_conversion_error          (BablConversion *conversion);
index e4a22e300f55b1c854e1a9d3b896ab2a0f1d560d..bbb548fcec3c26538f23475dcb8cf01243852d6f 100644 (file)
@@ -21,8 +21,7 @@
 #include <assert.h>
 #include <math.h>
 
-#include "babl.h"
-#include "babl-ids.h"
+#include "babl-internal.h"
 #include "babl-base.h"
 
 
index 4e32fbb52007246966591e465707c62bb148426c..cb1854a355aefd4690fe08d6040761b5b078da43 100644 (file)
@@ -21,8 +21,7 @@
 #include <assert.h>
 #include <math.h>
 
-#include "babl.h"
-#include "babl-ids.h"
+#include "babl-internal.h"
 #include "babl-base.h"
 
 static inline long
index e6ae55734091dce4de4e8b3381928043a3553cb9..592258f856e58047cd39c8f36669adaa329c5718 100644 (file)
@@ -20,8 +20,7 @@
 #include <assert.h>
 #include <stdint.h>
 
-#include "babl.h"
-#include "babl-ids.h"
+#include "babl-internal.h"
 #include "babl-base.h"
 
 #include <math.h>
index 3e7a2cbbc36e4ffefbd44ce103e1cf44ed5c5d2b..7384c8f00365c2ad01581415bc4ea4b65ed4439b 100644 (file)
@@ -247,8 +247,10 @@ AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
 dnl ===========================================================================
 
 AC_SEARCH_LIBS([dlopen], [dl])
+AC_SEARCH_LIBS([rint], [m])
 
 AC_REPLACE_FUNCS(gettimeofday)
+AC_CHECK_FUNCS(rint)
 
 #BABL_PATH_SEPARATOR must be defined as a character.
 #BABL_DIR_SEPARATOR must be defined as a string.
index 7f5f59f5bf851eed6118190ff3274aa1e950ad3a..47cbbd5d35e575a56504f1e0bc5a6db55de19f16 100644 (file)
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "config.h"
-
 #include <math.h>
 #include <string.h>
 
 #include "babl.h"
+#include "extensions/util.h"
 
 
 int init (void);
index 65482bf48ac8c5ec3dfd439e18af838396b61e89..084db947bccfe171eb28de95ddc90365f1ee6520 100644 (file)
  * TODO: error diffusion,
  */
 
-#include "config.h"
-
 #include "babl.h"
 
 #include "base/util.h"
+#include "extensions/util.h"
 
 
 #define INLINE    inline
index 87667dd1aa52c6e3fe414a84e99a28b7c75690c7..0fcfd7bd07ddc776ea8980c0a65925d8f834673e 100644 (file)
  *  Copyright 2003, 2004, 2005 Øyvind Kolås <pippin@gimp.org>
  */
 
-#include "config.h"
-
 #include <math.h>
 #include <string.h>
 
 #include "babl.h"
+#include "extensions/util.h"
 
 
 #define INLINE    inline
index f8fc25021d9f760c10eaffa88b6e82896de138ca..e24e51c61cda02aff6d1f7493ec625dc0320303f 100644 (file)
  *  Copyright 2003, 2004, 2005 Øyvind Kolås <pippin@gimp.org>
  */
 
-#include "config.h"
-
 #include <math.h>
 #include <string.h>
 
 #include "babl.h"
+#include "extensions/util.h"
 
 
 #define INLINE    inline
index e2faf051c8a3c7ee0a4fb54fc0aad948f94c5431..7868cb88ff325ac2cb3e5358d748b98b8721a360 100644 (file)
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "config.h"
-
 #include <stdio.h>
 
 #include "babl.h"
 
 #include "base/util.h"
+#include "extensions/util.h"
 
 #define INLINE    inline
 
index 0a9e7c648f876c9c75cad634d1dd461bbcfd988d..4836dfe70876d8422c1910fb8d93fd1df7b7674d 100644 (file)
 #include <assert.h>
 #include <math.h>
 
+#include "config.h"
+
+#ifndef HAVE_RINT
+# define rint(f)  ((long) floor (((double) f) + 0.5))
+#endif
+
+
 #define BABL_PLANAR_SANITY  \
   {                         \
     assert(src_bands>0);    \